import java.util.ArrayList;
import java.util.List;

public class AreAlmostEqual {

    public static boolean solution(String s1,String s2){
        if(s1.equals(s2)){
            return true;
        }
        List<Integer> diff=new ArrayList<>();
        int n = s1.length();
        for (int i = 0; i <n ; i++) {
            if(s1.charAt(i)!=s2.charAt(i)){
                diff.add(i);
            }
            if(diff.size()>2){
                return false;
            }
        }
        if(diff.size()!=2){
            return false;
        }
        if(s1.charAt(diff.get(0))==s2.charAt(diff.get(1))&&s2.charAt(diff.get(0))==s1.charAt(diff.get(1))){
            return true;
        }else {
            return false;
        }
    }

    public static void main(String[] args) {
        System.out.println(solution("aa","ac"));
    }
}
